home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Controls / Visual Basic Controls.iso / vbcontrol / easyx / data1.cab / Example_Files / EX_6 / Form1.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1998-11-03  |  9.1 KB  |  285 lines

  1. VERSION 5.00
  2. Object = "{C61830C1-8B47-11D4-9F3F-0000B45C4CF6}#1.0#0"; "EASYSOUND.OCX"
  3. Begin VB.Form frmEasySound 
  4.    Caption         =   "Using Sounds"
  5.    ClientHeight    =   5475
  6.    ClientLeft      =   60
  7.    ClientTop       =   345
  8.    ClientWidth     =   4620
  9.    Icon            =   "Form1.frx":0000
  10.    LinkTopic       =   "Form1"
  11.    ScaleHeight     =   5475
  12.    ScaleWidth      =   4620
  13.    StartUpPosition =   3  'Windows Default
  14.    Begin VB.CommandButton cmdSetGunFreq 
  15.       Caption         =   "Set Frequency"
  16.       Height          =   495
  17.       Left            =   1680
  18.       TabIndex        =   17
  19.       Top             =   4200
  20.       Width           =   1215
  21.    End
  22.    Begin VB.TextBox txtGunFreq 
  23.       Height          =   285
  24.       Left            =   1680
  25.       MaxLength       =   6
  26.       TabIndex        =   16
  27.       Top             =   4800
  28.       Width           =   1215
  29.    End
  30.    Begin VB.TextBox txtBoinkFreq 
  31.       Height          =   285
  32.       Left            =   120
  33.       MaxLength       =   6
  34.       TabIndex        =   15
  35.       Top             =   4800
  36.       Width           =   1215
  37.    End
  38.    Begin VB.CommandButton cmdSetBoinkFreq 
  39.       Caption         =   "Set Frequency"
  40.       Height          =   495
  41.       Left            =   120
  42.       TabIndex        =   14
  43.       Top             =   4200
  44.       Width           =   1215
  45.    End
  46.    Begin VB.CommandButton cmdGetBoinkFreq 
  47.       Caption         =   "Get Frequency"
  48.       Height          =   495
  49.       Left            =   120
  50.       TabIndex        =   12
  51.       Top             =   3120
  52.       Width           =   1215
  53.    End
  54.    Begin VB.CommandButton cmdGetCountFreq 
  55.       Caption         =   "Get Frequency"
  56.       Height          =   495
  57.       Left            =   3240
  58.       TabIndex        =   9
  59.       Top             =   2280
  60.       Width           =   1215
  61.    End
  62.    Begin VB.CommandButton cmdGetGunFreq 
  63.       Caption         =   "Get Frequency"
  64.       Height          =   495
  65.       Left            =   1680
  66.       TabIndex        =   8
  67.       Top             =   3120
  68.       Width           =   1215
  69.    End
  70.    Begin VB.CommandButton cmdPlayDupGun 
  71.       Caption         =   "Play duplicate gun"
  72.       Enabled         =   0   'False
  73.       Height          =   495
  74.       Left            =   1680
  75.       TabIndex        =   7
  76.       Top             =   2280
  77.       Width           =   1215
  78.    End
  79.    Begin VB.CommandButton cmdPlayDupBoink 
  80.       Caption         =   "Play Duplicate boink"
  81.       Enabled         =   0   'False
  82.       Height          =   495
  83.       Left            =   120
  84.       TabIndex        =   6
  85.       Top             =   2280
  86.       Width           =   1215
  87.    End
  88.    Begin VB.CommandButton cmdStop 
  89.       Caption         =   "Stop Count"
  90.       Height          =   495
  91.       Left            =   3240
  92.       TabIndex        =   5
  93.       Top             =   1320
  94.       Width           =   1215
  95.    End
  96.    Begin VB.CommandButton cmdDupBoink 
  97.       Caption         =   "Duplicate boink"
  98.       Height          =   495
  99.       Left            =   120
  100.       TabIndex        =   4
  101.       Top             =   1320
  102.       Width           =   1215
  103.    End
  104.    Begin VB.CommandButton cmdDupGun 
  105.       Caption         =   "Duplicate Gun"
  106.       Height          =   495
  107.       Left            =   1680
  108.       TabIndex        =   3
  109.       Top             =   1320
  110.       Width           =   1215
  111.    End
  112.    Begin VB.CommandButton cmdStream 
  113.       Caption         =   "&Count down"
  114.       Height          =   495
  115.       Left            =   3240
  116.       TabIndex        =   2
  117.       Top             =   240
  118.       Width           =   1215
  119.    End
  120.    Begin VB.CommandButton cmdMachine 
  121.       Caption         =   "&Machine Gun"
  122.       Height          =   495
  123.       Left            =   1680
  124.       TabIndex        =   1
  125.       Top             =   240
  126.       Width           =   1215
  127.    End
  128.    Begin VB.CommandButton cmdBoink 
  129.       Caption         =   "&Boink"
  130.       Height          =   495
  131.       Left            =   120
  132.       TabIndex        =   0
  133.       Top             =   240
  134.       Width           =   1215
  135.    End
  136.    Begin EASYSOUNDLibCtl.ESound ESound 
  137.       Left            =   3240
  138.       OleObjectBlob   =   "Form1.frx":014A
  139.       Top             =   3480
  140.    End
  141.    Begin VB.Label lblGunLenght 
  142.       AutoSize        =   -1  'True
  143.       Caption         =   "Length: "
  144.       ForeColor       =   &H00FF0000&
  145.       Height          =   195
  146.       Left            =   1680
  147.       TabIndex        =   19
  148.       Top             =   840
  149.       Width           =   585
  150.    End
  151.    Begin VB.Label lblBoinkLenght 
  152.       AutoSize        =   -1  'True
  153.       Caption         =   "Length: "
  154.       ForeColor       =   &H00FF0000&
  155.       Height          =   195
  156.       Left            =   120
  157.       TabIndex        =   18
  158.       Top             =   840
  159.       Width           =   585
  160.    End
  161.    Begin VB.Label lblBoinkFreq 
  162.       AutoSize        =   -1  'True
  163.       Caption         =   "Frequency: "
  164.       ForeColor       =   &H00FF0000&
  165.       Height          =   195
  166.       Left            =   120
  167.       TabIndex        =   13
  168.       Top             =   3840
  169.       Width           =   840
  170.    End
  171.    Begin VB.Label lblFreqCount 
  172.       AutoSize        =   -1  'True
  173.       Caption         =   "Frequency: "
  174.       ForeColor       =   &H00FF0000&
  175.       Height          =   195
  176.       Left            =   3240
  177.       TabIndex        =   11
  178.       Top             =   2880
  179.       Width           =   840
  180.    End
  181.    Begin VB.Label lblGunFreq 
  182.       AutoSize        =   -1  'True
  183.       Caption         =   "Frequency: "
  184.       ForeColor       =   &H00FF0000&
  185.       Height          =   195
  186.       Left            =   1680
  187.       TabIndex        =   10
  188.       Top             =   3840
  189.       Width           =   840
  190.    End
  191. Attribute VB_Name = "frmEasySound"
  192. Attribute VB_GlobalNameSpace = False
  193. Attribute VB_Creatable = False
  194. Attribute VB_PredeclaredId = True
  195. Attribute VB_Exposed = False
  196. Option Explicit
  197. Dim StaticMachineGun As Long
  198. Dim StaticBoink As Long
  199. Dim StreamCount As Long
  200. Dim StaticDupGun As Long
  201. Dim StaticDupBoink As Long
  202. Private Sub cmdBoink_Click()
  203. lblBoinkLenght.Caption = "Length: " & ESound.GetStaticByteLength(StaticBoink)
  204. ESound.PlayStaticSound StaticBoink, 0
  205. End Sub
  206. Private Sub cmdDupBoink_Click()
  207. StaticDupBoink = ESound.DuplicateStaticSound(StaticBoink)
  208. cmdPlayDupBoink.Enabled = True
  209. End Sub
  210. Private Sub cmdDupGun_Click()
  211.     StaticDupGun = ESound.DuplicateStaticSound(StaticMachineGun)
  212.     cmdPlayDupGun.Enabled = True
  213. End Sub
  214. Private Sub cmdGetBoinkFreq_Click()
  215. lblBoinkFreq.Caption = "Frequency: " & ESound.GetStaticFrequency(StaticBoink)
  216. End Sub
  217. Private Sub cmdGetCountFreq_Click()
  218. lblFreqCount.Caption = "Frequency: " & ESound.GetStreamingFrequency(StreamCount)
  219. End Sub
  220. Private Sub cmdGetGunFreq_Click()
  221. lblGunFreq.Caption = "Frequency: " & ESound.GetStaticFrequency(StaticMachineGun)
  222. End Sub
  223. Private Sub cmdMachine_Click()
  224. lblGunLenght.Caption = "Length: " & ESound.GetStaticByteLength(StaticMachineGun)
  225. ESound.PlayStaticSound StaticMachineGun, 0
  226. End Sub
  227. Private Sub cmdPlayDupBoink_Click()
  228.     ESound.PlayStaticSound StaticDupBoink, 0
  229. End Sub
  230. Private Sub cmdPlayDupGun_Click()
  231. ESound.PlayStaticSound StaticDupGun, 0
  232. End Sub
  233. Private Sub cmdSetBoinkFreq_Click()
  234. If CLng(Val(txtBoinkFreq.Text)) > 100 Or CLng(Val(txtBoinkFreq.Text)) < 100000 Then
  235.     ESound.SetStaticFrequency StaticBoink, CLng(Val(txtBoinkFreq.Text))
  236. End If
  237. End Sub
  238. Private Sub cmdSetGunFreq_Click()
  239. If CLng(Val(txtGunFreq.Text)) > 100 Or CLng(Val(txtGunFreq.Text)) < 100000 Then
  240.    ESound.SetStaticFrequency StaticMachineGun, CLng(Val(txtGunFreq.Text))
  241. End If
  242. End Sub
  243. Private Sub cmdStop_Click()
  244.     ESound.StopStreamingSound StreamCount
  245. End Sub
  246. Private Sub cmdStream_Click()
  247. ESound.PlayStreamingSound StreamCount, 0
  248. End Sub
  249. Private Sub Command1_Click()
  250. Debug.Print ESound.GetCurrentStaticPosition(StaticMachineGun)
  251. End Sub
  252. Private Sub Command2_Click()
  253.  ESound.SetCurrentStaticPosition StaticBoink, 5000
  254.  Debug.Print ESound.GetCurrentStaticPosition(StaticBoink)
  255. End Sub
  256. Private Sub Form_Load()
  257. Dim rt As Long
  258. Dim AppPath As String
  259. t forget this
  260. ESound.Window = Me.hWnd
  261. 'Initialize the sound machine
  262. rt = ESound.InitializeSound()
  263. If rt <> EX_OK Then
  264.     MsgBox "Could Not initialize sound", vbOKOnly, "Failure"
  265.     Exit Sub
  266. End If
  267. AppPath = App.Path & "\"
  268. StaticMachineGun = ESound.CreateStaticSound(AppPath & "machine.wav")
  269. If StaticMachineGun < 0 Then
  270.     MsgBox "Could not load machine gun sound", vbOKOnly, "Failure"
  271.     cmdMachine.Enabled = False
  272. End If
  273. StaticBoink = ESound.CreateStaticSound(AppPath & "boink.wav")
  274. If StaticBoink < 0 Then
  275.     MsgBox "Could not load boink sound", vbOKOnly, "Failure"
  276.     cmdBoink.Enabled = False
  277. End If
  278. StreamCount = ESound.CreateStreamingSound(AppPath & "countdown.wav")
  279. If StreamCount < 0 Then
  280.     MsgBox "Could not load count sound", vbOKOnly, "Failure"
  281.     cmdStream.Enabled = False
  282.     cmdStop.Enabled = False
  283. End If
  284. End Sub
  285.